package color.koitq.picker.adapter;

import android.graphics.Color;

import androidx.annotation.NonNull;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import color.koitq.picker.R;
import color.koitq.picker.entity.ColorModel;
import color.koitq.picker.util.Util;

public class ColorAdapter extends BaseQuickAdapter<ColorModel, BaseViewHolder> {
    private int  pos;
    public ColorAdapter() {
        super(R.layout.item_color);
    }

    public void  update(int pos) {
        this.pos=pos;
        notifyDataSetChanged();
    }

    @Override
    protected void convert(@NonNull BaseViewHolder baseViewHolder, ColorModel model) {
        baseViewHolder.setBackgroundColor(R.id.img, Color.parseColor(model.color));
    }
}
